package com.dream.xiaobo.dao;

import com.dream.xiaobo.entity.Cart;

import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.List;

/**
 * @author xiaobo
 * @date 2021/9/1 - 9:41
 */
public interface CartDao {

    //根据商品Id和用户Id查询该商品是否存在购物车中的方法
    Cart hasCart(Integer uId, String pId) throws SQLException, InvocationTargetException, IllegalAccessException;

    //更新购物车
    Integer updateCart(Cart cart) throws SQLException;

    //添加购物车
    Integer insertCart(Cart cart) throws SQLException;

    //根据用户Id查询购物车中商品信息
    List<Cart> selectCartByUid(Integer uId) throws SQLException, InvocationTargetException, IllegalAccessException;

    //根据购物车Id删除方法
    void deleteCartByCId(String cId) throws SQLException;

    //根据购物车Id更新的方法
    void updateNumANDPrice(String cId, String cNum, String price) throws SQLException;

    //根据用户Id删除的方法
    void deleteCartByUId(String uId) throws SQLException;
}
